package cn.bugstack.mybatis.transaction;

import cn.bugstack.mybatis.session.TransactionIsolationLevel;

import javax.sql.DataSource;
import java.sql.Connection;

/**
 * @author wcc
 * @description 事务工厂
 * @create
 */

public interface TransactionFactory {
    /**
     * 根据connection创建Transaction
     * */
    Transaction newTransaction(Connection connection);

    /**
     *根据数据源和事务隔离级别创建 Transaction
     * */
    Transaction newTransaction(DataSource dataSource, TransactionIsolationLevel level, boolean autoCommit);
}
